package study.springboot.starter.tacker.feign;

import feign.RequestInterceptor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Slf4j
@Configuration
//类存在时加载
@ConditionalOnClass(EnableFeignClients.class)
public class FeignTrackerAutoConfiguration {

    @Bean
    public RequestInterceptor requestInterceptor() {
        log.info(">>>>>> create RequestInterceptor for FeignClient");
        return new FeignHeaderInterceptor();
    }
}
